<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="../../include/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>会员信息</title>
   <link rel="stylesheet" type="text/css" href="${ctx}/resources/media/css/select2_metro.css" />
    <link href="${ctx}/resources/media/css/bootstrap-fileupload.css"
	rel="stylesheet" type="text/css" />
<link href="${ctx}/resources/media/css/chosen.css" rel="stylesheet"
	type="text/css" />
<link href="${ctx}/resources/media/css/profile.css" rel="stylesheet"
	type="text/css" />
<script type="text/javascript"
	src="${ctx}/resources/media/js/bootstrap-fileupload.js"></script>
<script type="text/javascript"
	src="${ctx}/resources/media/js/chosen.jquery.min.js"></script>
</head>
<body>
	<div class="row-fluid profile">
		<div class="span12">
			<!--BEGIN TABS-->
			<div class="tabbable tabbable-custom tabbable-full-width">
				<ul class="nav nav-tabs">
					<li><a href="${ctx}/member/user">会员列表</a></li>
					<li class="active"><a href="${ctx}/member/user/view/${member.id}">会员概览</a></li>
				</ul>
				<div class="tab-content">
					<div class="tab-pane row-fluid active" id="tab_1_1">
						<ul class="unstyled profile-nav span3">
					<%-- 		<li><img src="${ctx}/${member.image}" alt="" /> <a
								href="#" class="profile-edit">edit</a></li> --%>
							<li><a href="#">会员ID：${member.id }</a></li>
							<li><a href="#">姓名：${member.realName }</a></li>
							<li><a href="#">证件类型：${member.identityType eq  1 ? '身份证':'其它证件'}</a></li>
							<li><a href="#">手机号码：${member.mobile }</a></li>
							<li><a href="#">证件号码：${member.identityNumber }</a></li>
							<li><a href="#">登陆次数：${member.loginCount }</a></li>
						</ul>
						<div class="span9">
							<div class="row-fluid">
								<div class="span8 profile-info form-horizontal form-view">
									<h1 >${member.realName}</h1>
									<div class="row-fluid">
										<div class="span6">
											<div class="control-group">
												<label class="control-label icon-star" for="firstName">会员级别：${member.level eq 1 ? '高级投资人' : '初级投资人'}</label>
											</div>
										</div>
										<div class="span6">
											<div class="control-group">
												<label class="control-label icon-heart"  for="firstName">会员类型：${member.type eq 1 ? '普通用户' : '投资用户'}</label>
											</div>
										</div>
									</div>
									
									<hr>
										<div class="row-fluid">
										<div class="span6">
											<div class="control-group">
												<label class="control-label icon-map-marker" for="firstName">认证类型：${member.authType eq 0  ? '未认证' : '实名认证' }</label>
											</div>
										</div>
										<div class="span6">
											<div class="control-group">
												<label class="control-label icon-calendar"  for="firstName">认证时间：${member.authTime}</label>
											</div>
										</div>
									</div>
									
									<hr>
								<!-- 	<ul class="unstyled inline">
										<li><i class="icon-map-marker"></i> Spain</li>
										<li><i class="icon-calendar"></i> 18 Jan 1982</li>
										<li><i class="icon-briefcase"></i> Design</li>
										<li><i class="icon-star"></i> Top Seller</li>
										<li><i class="icon-heart"></i> BASE Jumping</li>
									</ul> -->
								</div>
								<!--end span8-->
								<div class="span4">
									<div class="portlet sale-summary">
										<div class="portlet-title">
											<div class="caption">个人资产</div>
										<!-- 	<div class="tools">
												<a class="reload" href="javascript:;"></a>
											</div> -->
										</div>
										<ul class="unstyled">
											<li><span class="sale-info ">产品数量 <i
													class="icon-img-up"></i></span> <span class="sale-num"><fmt:formatNumber pattern="#.##">${invest.count }</fmt:formatNumber></span></li>
											<li><span class="sale-info">产品金额 <i
													class="icon-img-down"></i></span> <span class="sale-num">￥<fmt:formatNumber pattern="#.##">${invest.amount }</fmt:formatNumber></span>
											</li>
											<li><span class="sale-info">总盈利</span> <span
												class="sale-num">￥<fmt:formatNumber pattern="#.##">${invest.earnedProfit }</fmt:formatNumber></span></li>
												<li><span class="sale-info">可用余额</span> <span
												class="sale-num">￥<fmt:formatNumber pattern="#.##">${account.avaliableBalance }</fmt:formatNumber></span></li>
												<li><span class="sale-info">代金卷余额</span> <span
												class="sale-num">￥<fmt:formatNumber pattern="#.##">${account.voucherBalance }</fmt:formatNumber></span></li>
											<li><span class="sale-info">总资产</span> <span
												class="sale-num">￥<fmt:formatNumber pattern="#.##">${account.bookBalance}</fmt:formatNumber> </span></li>
										</ul>
									</div>
								</div>
								<!--end span4-->
							</div>
							<!--end row-fluid-->
							<div class="tabbable tabbable-custom tabbable-custom-profile">
								<ul class="nav nav-tabs">
									<li class="active"><a href="#tab_1_11" data-toggle="tab">所购产品</a></li>
									<li class=""><a href="#tab_1_22" data-toggle="tab">购买记录</a></li>
									<li class=""><a href="#tab_1_33" data-toggle="tab">交易流水</a></li>
								</ul>
								<div class="tab-content">
									<div class="tab-pane active" id="tab_1_11">
										<div class="portlet-body" style="display: block;">
											<table
												class="table table-striped table-bordered table-advance table-hover" id="dataTable1">
												<thead>
													<tr>
														<th><i class="icon-briefcase"></i> 所属产品</th>
														<th><i class="icon-briefcase"></i> 产品编号</th>
														<th class="hidden-phone"><i class="icon-question-sign"></i> 产品名称</th>
														<th><i class="icon-bookmark"></i> 产品收益率/周期</th>
														<th><i class="icon-bookmark"></i> 所购数量</th>
														<th></th>
													</tr>
												</thead>
												<tbody>
													
												</tbody>
											</table>
										</div>
									</div>
									<!--tab-pane-->
									<div class="tab-pane" id="tab_1_22">
										<div class="portlet-body" style="display: block;">
											<table
												class="table table-striped table-bordered table-advance table-hover" id="dataTable2">
												<thead>
													<tr>
														<th><i class="icon-briefcase"></i> 产品编号</th>
														<th class="hidden-phone"><i
															class="icon-question-sign"></i> 产品名称</th>
														<th><i class="icon-bookmark"></i> 购买数量</th>
														<th><i class="icon-bookmark"></i> 购买时间</th>
														<th></th>
													</tr>
												</thead>
												<tbody>
													
												</tbody>
											</table>
										</div>
									</div>
									<!--tab-pane-->
									<div class="tab-pane" id="tab_1_33">
										<div class="portlet-body" style="display: block;">
											<table
												class="table table-striped table-bordered table-advance table-hover" id="dataTable3">
												<thead>
													<tr>
														<th><i class="icon-briefcase"></i> 交易帐号</th>
														<th class="hidden-phone"><i
															class="icon-question-sign"></i> 金额</th>
															<th class="hidden-phone"><i
															class="icon-question-sign"></i> 交易类型</th>
														<th><i class="icon-bookmark"></i> 交易日期</th>
														<th></th>
													</tr>
												</thead>
												<tbody>
													
												</tbody>
											</table>
										</div>
									</div>
									
									
									</div>
									<!--tab-pane-->
								</div>
							</div>
						</div>
						<!--end span9-->
					</div>
				</div>
				<!--END TABS-->
			</div>
		</div>

    <script type="text/javascript" src="${ctx}/resources/media/js/select2.min.js"></script>
 	<script type="text/javascript" src="${ctx}/resources/media/js/jquery.dataTables.js"></script>
    <script type="text/javascript" src="${ctx}/resources/media/js/DT_bootstrap.js"></script>
    <script type="text/javascript">

    var dt1;
	var dt2;
	var dt3;
	
	$(function() {
		
		$("select").select2();

        dt1 = $('#dataTable1')
				.dataTable(
						{
							"bLengthChange" : false,
							"bFilter" : false,
							"bInfo" : false,
							"iDisplayLength" : 20,
							"bSort" : false,
							"sDom" : "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
							"sPaginationType" : "bootstrap",
                            "bServerSide":true,
                            "sAjaxSource":"${ctx}/member/user/buyProData.json",
							"oLanguage" : {
								"oPaginate" : {
									"sPrevious" : "上一页",
									"sNext" : "下一页"
								}
							},
                            "aoColumns":[
                                {
                                	"mData":null,
                                    "fnRender":function(oObj){
                                    	var type = oObj.aData.type;
                                    	if(type == 1){
                                    		return '美丽理财';
                                    	}else if(type == 2) {
                                    		return '小豆理财';
                                    	}
                                    }
                                },{
                                    "mData":"id"
                                },{
                                    "mData":"title"
                                },{
                                	"mData":null,
                                	 "fnRender":function(oObj){
                                    	 var text = "";
                                    	 if(oObj.aData.type ==1){
                                    		 text = oObj.aData.term +"个月";
                                    	 }else if(oObj.aData.type ==2){
                                    		 text = oObj.aData.minProfitRate+"%";
                                    	 }
                                    	 
                                    	 return text;
                                	 }
                                
                                },{
                                    "mData":"count"
                                }

                            ],
                            "fnServerData":function(sSource,aoData,fnCallback){
                                for(i in aoData){
                                    if(aoData[i].name == "sSearch")
                                        aoData[i].name = "realName";
                                }
                                aoData.push({name:'status',value:$("#status").val()}); 
                                $.ajax({
                                    "dataType":'json',
                                    "type":'POST',
                                    "url":sSource,
                                    "data":aoData,
                                    "success":fnCallback
                                });
                            }
						});

		jQuery('#dataTable_wrapper .row-fluid:first').remove();
		jQuery('#dataTable_wrapper .dataTables_length select').addClass("m-wrap small"); // modify table per page dropdown
			

		
		dt2= $('#dataTable2')
		.dataTable(
				{
					"bLengthChange" : false,
					"bFilter" : false,
					"bInfo" : false,
					"iDisplayLength" : 20,
					"bSort" : false,
					"sDom" : "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
					"sPaginationType" : "bootstrap",
                    "bServerSide":true,
                    "sAjaxSource":"${ctx}/member/user/buyRecordData.json",
					"oLanguage" : {
						"oPaginate" : {
							"sPrevious" : "上一页",
							"sNext" : "下一页"
						}
					},
                    "aoColumns":[
                        {
                            "mData":"id"
                        },{
                            "mData":"title"
                        },{
                            "mData":"count"
                        },{
                            "mData":"investDate"
                        }

                    ],
                    "fnServerData":function(sSource,aoData,fnCallback){
                        for(i in aoData){
                            if(aoData[i].name == "sSearch")
                                aoData[i].name = "realName";
                        }
                        aoData.push({name:'status',value:$("#status").val()}); 
                        $.ajax({
                            "dataType":'json',
                            "type":'POST',
                            "url":sSource,
                            "data":aoData,
                            "success":fnCallback
                        });
                    }
				});

		jQuery('#dataTable_wrapper .row-fluid:first').remove();
		jQuery('#dataTable_wrapper .dataTables_length select').addClass("m-wrap small"); // modify table per page dropdown
				
					
		dt3 = $('#dataTable3')
		.dataTable(
				{
					"bLengthChange" : false,
					"bFilter" : false,
					"bInfo" : false,
					"iDisplayLength" : 20,
					"bSort" : false,
					"sDom" : "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
					"sPaginationType" : "bootstrap",
		            "bServerSide":true,
		            "sAjaxSource":"${ctx}/member/user/tranData.json",
					"oLanguage" : {
						"oPaginate" : {
							"sPrevious" : "上一页",
							"sNext" : "下一页"
						}
					},
		            "aoColumns":[
		                {
		                    "mData":"account"
		                },{
		                    "mData":"amount"
		                },{
		                	"mData":null,
                            "fnRender":function(oObj){
                            	var type = oObj.aData.type;
                            	if(type == 0){
                            		return '充值交易';
                            	}else if(type == 1) {
                            		return '提现交易';
                            	}else if(type == 3) {
                            		return '投资';
                            	}else if(type == 4) {
                            		return '获取收益';
                            	}else if(type == 5) {
                            		return '本金归还';
                            	}else if(type == 6) {
                            		return '利息归还';
                            	}else {
                            		return '其它交易';
                            	}
                            }
                        },{
		                    "mData":"txnDate"
		                }
		
		            ],
		            "fnServerData":function(sSource,aoData,fnCallback){
		                for(i in aoData){
		                    if(aoData[i].name == "sSearch")
		                        aoData[i].name = "realName";
		                }
		                aoData.push({name:'status',value:$("#status").val()}); 
		                $.ajax({
		                    "dataType":'json',
		                    "type":'POST',
		                    "url":sSource,
		                    "data":aoData,
		                    "success":fnCallback
		                });
		            }
				});
		
		jQuery('#dataTable_wrapper .row-fluid:first').remove();
		jQuery('#dataTable_wrapper .dataTables_length select').addClass("m-wrap small"); // modify table per page dropdown
		
						
						
	});



    </script>
</body>
</html>